
package com.scalar.chiptrack.commons;

import java.util.HashMap;
import java.util.ArrayList;
import java.util.Iterator;

import com.scalar.chiptrack.users.User;
import com.scalar.ScalarException;

public abstract class Holds {

  // ----------------------------------------------------- Instance Variables
  private HashMap holdTypes = new HashMap();
  private int criteria = -1;
  
  private boolean loadHold_orders = false;
  
  public static final int SALES_ORDER_BY_PRODUCT = 1;
  public static final int SALES_ORDER_BY_CUSTOMER = 2;
  public static final int SALES_ORDER_BY_CUSOTMER_PO = 3;
  public static final int SALES_ORDER_BY_CUSTOMER_AND_PRODUCT = 4;

  //Added by Rohan on August 28th 2003 for indicating the search criteria on all the tree (salesOrderNo,Product,Customer)
  public static final int SALES_ORDER_BY_SALESORDERNO_PRODUCT_CUSTOMER=5;
  public static final int SALES_ORDER_BY_SALESORDERNO_PRODUCT_CUSTOMER_YEAR=6;
  public static final int SALES_ORDER_BY_CUSTOMER_PRODUCT_YEAR = 7;

  /**
   * Default Constructor
   *
   */
  public Holds() {

  }
  
  public String getParameter(String type)
  {     
      return (String)holdTypes.get(type);
  }
  
  public void setParameter(String type, String value)
  { 
      holdTypes.put(type,value);
  }
  
  public int getCriteria()
  {
      return criteria;
  }
  
  public void setCriteria(int criteria)
  {
      this.criteria = criteria;
  }
  
  public boolean getLoadHoldOrders()
  {
      return loadHold_orders;
  }
  
  public void setLoadHoldOrders(boolean loadHold_orders)
  {
      this.loadHold_orders = loadHold_orders;
  }
  
  public abstract ArrayList load() throws ScalarException;
  public abstract void hold(User user) throws ScalarException; 
  public abstract void hold(Iterator list,User user) throws ScalarException;
  public abstract void release(User user) throws ScalarException; 
  public abstract void release(Iterator list, User user) throws ScalarException;
  public abstract void save(Iterator list, User user, String comments) throws ScalarException;
  
}
